﻿using System;
using System.Collections.Generic;
using System.Linq;
using DsLib;
using System.IO;

namespace DotNetFeatures
{
    #region Ext-AnonymousMethods-Lambda-LINQ-Tests
    public static class ExtensionMethods
    {
        public static void ExecuteBSTIEnumTests()
        {
            int[] arr = { 1, 2, 3, 1, 4, 5, 2, 3, 6, 4, 8, 9, 10, 11, 34, 12, 11, 0, 6, 9, 6, 1, 1, 1, 4, 3, 6, 2, 1, 24, 5, 3, 6 };
            BinarySearchTree<int> tree = BSTUtils.GetABuiltBST(arr);

            List<BinaryTreeNode<int>> list = new List<BinaryTreeNode<int>>();

            foreach (int i in arr)
            {
                list.Add(new BinaryTreeNode<int>(i));
            }

            IEnumerable<int> distinct = tree.Distinct();

            distinct = tree.Distinct(new GenericCompare2<int>());

            int summ = tree.Sum(FuncDelegates.intdoubler);
            int summ1 = tree.Sum(FuncDelegates.intsingler);

            distinct = tree.TakeWhile(FuncDelegates.intSelector);

            distinct = tree.TakeWhile(FuncDelegates.IntSelectMethod(0));

            foreach (var i in distinct)
            {
                Console.WriteLine(i);
            }

            Console.WriteLine("Count: " + distinct.Count());

            Console.ReadKey();

        }
    }
    #endregion
}
